<template>
  <div class="app-container">
    <el-row :gutter="10">
      <el-col
        :span="6"
        v-for="item in list"
        :key="item.templateName"
      >
        <el-card>
          <div
            class="item"
            @click="handleModule(item)"
          >
            <img
              src="@/assets/images/icon1.png"
              alt=""
            >
            <span>{{ item.templateName }}</span>
          </div>
        </el-card>
      </el-col>
    </el-row>
    <el-empty
      description="暂无数据"
      v-if="!list.length"
    ></el-empty>
    <ExamineDialog ref="examineDialogRef"></ExamineDialog>
  </div>
</template>

<script>
import ExamineDialog from './modules/ExamineDialog.vue'
import { availableTemplate } from '@/api/processManage/approveForms'
export default {
  // name: 'BusinessInitiation',
  components: { ExamineDialog },
  data() {
    return {
      list: []
    }
  },
  created() { },
  mounted() {
    this.handleAvailableTemplate()
  },
  methods: {
    handleAvailableTemplate() {
      availableTemplate().then(res => {
        this.list = res.data
      })
    },
    handleModule(item) {
      this.$router.push({
        name: 'ApproveForms',
        // query: {
        //   templateName: item.templateName,
        //   templateId: item.templateId
        // }
      })

      this.$store.commit('SET_PROCEDURE', JSON.stringify({
        templateType: '发起',
        templateName: item.templateName,
        templateId: item.templateId,
        paramsData: {
          flowNo: ''
        }
      }))
      localStorage.setItem("formDoc", JSON.stringify({}));
      // this.$refs.examineDialogRef.openDialog({
      //   title: '客户信用评分'
      // })
    }
  }
};
</script>

<style lang="scss" scoped>
.item {
  cursor: pointer;
  display: flex;
  align-items: center;
  img {
    width: 40px;
    height: 40px;
    margin-right: 10px;
  }
}
</style>